import 'package:flutter/material.dart';
 class TabBarDemo extends StatefulWidget {
    const TabBarDemo({super.key});
  @override
  State<TabBarDemo> createState() => _TabBarDemoState();
}

class _TabBarDemoState extends State<TabBarDemo> with SingleTickerProviderStateMixin{
   late TabController _tabController;
  @override
  void initState() {
    super.initState();
    _tabController = TabController(length: 5, vsync: this);
  }
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 10,
      child: Scaffold(
        appBar: AppBar(
          title: const Text('TabBar Widget'),
          centerTitle: true,
          bottom:  TabBar(
            dividerColor: Colors.blue,
            controller: _tabController,
            labelColor: Colors.red,
            unselectedLabelColor: Colors.purpleAccent,
            tabs:  const [
              Tab(text: "Tab 1"),
              Tab(text: "Tab 2"),
              Tab(text: "Tab 2"),
              Tab(text: "Tab 2"),
              Tab(text: "Tab 2"),
            ],
          ),
        ),
        body: TabBarView(
          controller: _tabController,
          children: [
            Container(
              color: Colors.red,
            ),
            Container(
              color: Colors.blue,
            ),
            Container(
              color: Colors.green,
            ),
            Container(
              color: Colors.yellow,
            ),
            Container(
              color: Colors.purple,
            ),
          ],
        ),
      )
    );
  }
}